//
//  ExperienceVoucherMoreTableViewController.m
//  GoodWayClient
//
//  Created by HuiDong on 15/12/3.
//  Copyright © 2015年 HuiDong. All rights reserved.
//

#import "ExperienceVoucherMoreTableViewController.h"
#import "AppDelegate.h"
#import "Constant.h"
#import "AFNetworking.h"
#import "CardInfo.h"

@interface ExperienceVoucherMoreTableViewController ()
@property (weak, nonatomic) IBOutlet UILabel *Card;
@property (weak, nonatomic) IBOutlet UILabel *descrip;
@property (weak, nonatomic) IBOutlet UILabel *time;

@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *iphone;
@property (weak, nonatomic) IBOutlet UILabel *time1;
@property (weak, nonatomic) IBOutlet UILabel *state;
@property (weak, nonatomic) IBOutlet UILabel *time2;
//退出当前页
- (IBAction)back:(id)sender;

@end

@implementation ExperienceVoucherMoreTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //网络请求
    AFHTTPRequestOperationManager *request = [AFHTTPRequestOperationManager manager];
    request.responseSerializer = [AFJSONResponseSerializer serializer];
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    AppDelegate *tempAppDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    dic[@"token"] = tempAppDelegate.token;
    dic[@"id"] = @1;
    
    [request POST:[NSString stringWithFormat:@"%@%@",url2,@"BluePeoGetCardInfo"] parameters:dic success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary *dic = (NSDictionary *)responseObject;
        if ([[NSString stringWithFormat:@"%@",dic[@"Status"]] isEqualToString:@"0"]) {
            NSDictionary *dic1 = dic[@"Data"];
            CardInfo *cardInfo = [[CardInfo alloc] initWithDic:dic1];
            self.Card.text = [NSString stringWithFormat:@"%@",cardInfo.CardNum];
            self.descrip.text = [NSString stringWithFormat:@"%@",cardInfo.Description];
            self.time.text = [NSString stringWithFormat:@"%@~%@",cardInfo.BeginTime,cardInfo.EndTime];
            self.name.text = [NSString stringWithFormat:@"%@",cardInfo.NickName];
            self.iphone.text = [NSString stringWithFormat:@"%@",cardInfo.PhoneNum];
            self.time1.text = [NSString stringWithFormat:@"%@",cardInfo.CreateTime];
            self.state.text = [NSString stringWithFormat:@"%d",cardInfo.Status];
            self.time2.text = [NSString stringWithFormat:@"%@",cardInfo.UseTime];
        }else
        {
            [[[UIAlertView alloc] initWithTitle:@"提示" message:dic[@"Message"] delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil] show];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"系统网络申请错误!");
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)back:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

//隐藏状态栏
-(UIStatusBarStyle)preferredStatusBarStyle
{
    return YES;
}
@end
